UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jLiz2DPruWrBPHyFLnYd+Co3gkId6ThX4YmNHcLM+MA=' 
WHERE 
  key_id = 'b8bff335dd0da54c308a3c0a6b111779cd12907cd8e86adfc2d91aa0505405f6' 
  AND (
    token = 'jLiz2DPruWrBPHyFLnYd+Co3gkId6ThX4YmNHcLM+MA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026