UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TNHqtw0srHLnKkD9LO2cDPYaQ+Hec9uOxwAMbSa48RA=' 
WHERE 
  key_id = 'c2993669deea7c80c63b538e410136363b01bc4f7f70734187812f6b50b699be' 
  AND (
    token = 'TNHqtw0srHLnKkD9LO2cDPYaQ+Hec9uOxwAMbSa48RA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032