UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ToQuzvxGj90sti8fHUglBTvkl0CGSkAab1JseNpZaE=' 
WHERE 
  key_id = '3331f947994a7b894ddf80900cb168b50d1b60554fa2d42982cb98935ae53246' 
  AND (
    token = '7ToQuzvxGj90sti8fHUglBTvkl0CGSkAab1JseNpZaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031