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

Query time 0.00029