UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+HWT8fg5JNTn+H2gv5vHb3EYBpg05cIujRPHBFcDaI=' 
WHERE 
  key_id = 'd11f98f0fb40f6313b71e896cda7a6d801260087d99a5008afc01bcb8af344b1' 
  AND (
    token = 'N+HWT8fg5JNTn+H2gv5vHb3EYBpg05cIujRPHBFcDaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023