UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4abue8zyoWXMYpTEAIEAd5kefKqQV7UTQQntCh2hqxU=' 
WHERE 
  key_id = 'b30fdd324fb79fd965979340c291051bb4beadc61aca677f815b401668a123f9' 
  AND (
    token = '4abue8zyoWXMYpTEAIEAd5kefKqQV7UTQQntCh2hqxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030