UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fialAdefIy1R4FCJVr47nBbwlabaxYL9VB5wNaODXFo=' 
WHERE 
  key_id = 'f56ade92646c6fd70515de80c66e2c04972099caf18b71ce0fb017dbf310af97' 
  AND (
    token = 'fialAdefIy1R4FCJVr47nBbwlabaxYL9VB5wNaODXFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050