UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm2XGyHUZG5NWm6eL+j3yb9i4HeA0GcoshpaQniBuPzs=' 
WHERE 
  key_id = '2025639b9829fab67273913df1eea5cb50c3f451351201407a34cd474809eeda' 
  AND (
    token = 'm2XGyHUZG5NWm6eL+j3yb9i4HeA0GcoshpaQniBuPzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030