UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '20VU3qmni4oEPHqOad9u6n63Rotzyq3YzLY5aRo9plE=' 
WHERE 
  key_id = 'b9720236dcdd19baed06422c2fb32e5d9b18743b87594feadee908b2cef841e3' 
  AND (
    token = '20VU3qmni4oEPHqOad9u6n63Rotzyq3YzLY5aRo9plE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030