UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DwNhSLmDKH5x2GGXT4fXXCj3FWCvPq1utt/rJIhDfdY=' 
WHERE 
  key_id = '12919741ae107bf93b584a10dcec70c2402ce3e4d3c8b5aa1c88f843b823f384' 
  AND (
    token = 'DwNhSLmDKH5x2GGXT4fXXCj3FWCvPq1utt/rJIhDfdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024