UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QbHN5+MPwo3rvPc9wJ4gQ4/w4531cCG78YxnfJjtyZE=' 
WHERE 
  key_id = 'a1318906a06fb77a42b16f04ad5d3ba1c6cf62b1c1907439b2cf69657a2b816a' 
  AND (
    token = 'QbHN5+MPwo3rvPc9wJ4gQ4/w4531cCG78YxnfJjtyZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028