UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xaYFe7orafohHfQYx0ot0AIVx2otloCVvTquKUPyZbo=' 
WHERE 
  key_id = '76440a0b746baccb0ff006e1d728373de3546ffe383150c0c9fae728596c5bef' 
  AND (
    token = 'xaYFe7orafohHfQYx0ot0AIVx2otloCVvTquKUPyZbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054