UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lIHCJ2WpRFoZbNlnKFc3A5EC/Z2ICjLQOQWq0AN+9iI=' 
WHERE 
  key_id = '043064b5640113047959118a104732de6e41e3ccee01f502ff694e6e10b0a0bb' 
  AND (
    token = 'lIHCJ2WpRFoZbNlnKFc3A5EC/Z2ICjLQOQWq0AN+9iI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031