UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A06srEAdPnfuwjeeSB6D+vQkyBUsNttYFlRsSlmI/dA=' 
WHERE 
  key_id = '507ed184fb42324cdeeb75d8ef5a79ac97a6314638f528b46a71c30fdc0a9be5' 
  AND (
    token = 'A06srEAdPnfuwjeeSB6D+vQkyBUsNttYFlRsSlmI/dA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053