UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dEspTO+PVaflcD61F8V+uxrtngRaybLfXdMu97bz4xs=' 
WHERE 
  key_id = '3acf1c9f9d3e64685d950de348879b32b49c754ebe6fe4c443e9f56ab877471e' 
  AND (
    token = 'dEspTO+PVaflcD61F8V+uxrtngRaybLfXdMu97bz4xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027