UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZpfiH+8J268VPRdQ8bXIQX8F0lXs+l1MBm4w39xTzE4=' 
WHERE 
  key_id = '7be1c13c670e34aa8d42d3684c56a51bcc7a5381789aa917151743257b8e665a' 
  AND (
    token = 'ZpfiH+8J268VPRdQ8bXIQX8F0lXs+l1MBm4w39xTzE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040