UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1do0MeKjFnx0bifAyg6vqbp52k5jA3jDeo2JlGx9Kew=' 
WHERE 
  key_id = '323a20f1029c044bbaafa61b0ded4af42c823a6b8260b7078a8032252261afb5' 
  AND (
    token = '1do0MeKjFnx0bifAyg6vqbp52k5jA3jDeo2JlGx9Kew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025