UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'axotVj61XSS+WCg/MVimLQzypgOp78k7oZlEWpghyYQ=' 
WHERE 
  key_id = '5877f38a81f5960689de97bd55008e2460e2968bf5d1ba124ea67e3661b14c32' 
  AND (
    token = 'axotVj61XSS+WCg/MVimLQzypgOp78k7oZlEWpghyYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028