UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kaYBBoop2nbtNzgm33GxjiW0Bc7iGYh20VQ2Hi8IaJc=' 
WHERE 
  key_id = '911ff3de18a2985b439e566d6a15bec69d7a5a09081ace0ae99b15da63f46671' 
  AND (
    token = 'kaYBBoop2nbtNzgm33GxjiW0Bc7iGYh20VQ2Hi8IaJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027