UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dw2TP9wh+mHzh5eeERXN8V2QZWWx53zEn6aEb383ONo=' 
WHERE 
  key_id = '2911a31731fbadcd7d4629be60420990eda51f3bc720a880a0ad15b7e52a76b3' 
  AND (
    token = 'dw2TP9wh+mHzh5eeERXN8V2QZWWx53zEn6aEb383ONo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033