UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JSbMq2YTTon7kUpBIUY2yOc+/J48lbIj6alVu41I+ZQ=' 
WHERE 
  key_id = '7b28c1c3c99ce01b260735253878cc2d2fa5e135583dfb77047e6f1f761106b2' 
  AND (
    token = 'JSbMq2YTTon7kUpBIUY2yOc+/J48lbIj6alVu41I+ZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026