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

Query time 0.00022