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

Query time 0.00017