UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f8EiyVuT1Qk/zqDjUiCbxqzvsXDlYb4qgL3dsDGipzA=' 
WHERE 
  key_id = '1fc02403249e9ef77f7f901a471edab1f9d083c78aa15f1d3a66c91bd317815d' 
  AND (
    token = 'f8EiyVuT1Qk/zqDjUiCbxqzvsXDlYb4qgL3dsDGipzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035