UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/XpCHuc//iqqTkMMLkccvy8m9JihhXygPRsVEMgx80=' 
WHERE 
  key_id = '3430178376dd1cf57cc56bfdc95acec7df8079aa162453677d57240d6a9bafcf' 
  AND (
    token = 'S/XpCHuc//iqqTkMMLkccvy8m9JihhXygPRsVEMgx80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020