UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rSIvh62dVF0OlxGkNVCcRhX801OhYpr622QIMGKJ7YU=' 
WHERE 
  key_id = '4a5b9fcba3326f5504a41c79c23c1b13284589372a7686eb219c9f4a5c8cca76' 
  AND (
    token = 'rSIvh62dVF0OlxGkNVCcRhX801OhYpr622QIMGKJ7YU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024