UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zgUOjy5vtOkoNQEwHsGgxCPO05eU5pS87enUfk+6avI=' 
WHERE 
  key_id = '9ad8a3057e1ab6e8045f1a73a40d48f161d85da5930500d72b76c93a6c5acb6c' 
  AND (
    token = 'zgUOjy5vtOkoNQEwHsGgxCPO05eU5pS87enUfk+6avI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028