UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AWDW5FRz3zlqZA/j8495/7iDcMMiRMBDBb4UqSVZ4vM=' 
WHERE 
  key_id = '52173047f5b6b14ca33b6c722bd7fc018d3d15e3aaca0905ff9f7cbde44dd28b' 
  AND (
    token = 'AWDW5FRz3zlqZA/j8495/7iDcMMiRMBDBb4UqSVZ4vM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038