UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J3Ze7TAkNJZMwBQmkPNW6U66BL5jZm0IdSuBPPdj1tU=' 
WHERE 
  key_id = '80508c9797f692d4f46f49d310ff84242750aa59d5311314ae06648e575db23b' 
  AND (
    token = 'J3Ze7TAkNJZMwBQmkPNW6U66BL5jZm0IdSuBPPdj1tU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027