UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UYnvEtYGp+fn1K46QZ5KTKmrk0fO/KhsNz/BKCpAewk=' 
WHERE 
  key_id = '767bb491205985cc5b40342d8efbdcc03c7d5eab3020fc42881e53fdf4230b04' 
  AND (
    token = 'UYnvEtYGp+fn1K46QZ5KTKmrk0fO/KhsNz/BKCpAewk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017