UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZWnctYyKdCPm+1IVJvKCD5/I0YgDHCO25g6g1RYhOHk=' 
WHERE 
  key_id = 'd9d95827dbea4863a49e4d243d0aea7e95a561e17bdf709b0c4c03dacc1e2e15' 
  AND (
    token = 'ZWnctYyKdCPm+1IVJvKCD5/I0YgDHCO25g6g1RYhOHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055