UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kcaFXKnPs6txtP1L2tKSbIBhP4XHQdsdjXO3BcOE+Hc=' 
WHERE 
  key_id = '8fccf3cfd924ea5a85eacebd258b59214eb516838001f1e8b353945a4ad3c648' 
  AND (
    token = 'kcaFXKnPs6txtP1L2tKSbIBhP4XHQdsdjXO3BcOE+Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017