UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PFOZTtRbXu1BaVc+56zZoAAH/fxQqgjXWy007YmGO/M=' 
WHERE 
  key_id = '33580c99f4b169050d88a6a79cf9c23417913189f47328feb7cb263eb9245e76' 
  AND (
    token = 'PFOZTtRbXu1BaVc+56zZoAAH/fxQqgjXWy007YmGO/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040