UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YOoY7A0ngW9Z2B43GFUbcEEZ61F6q047aypsCT5vw4Y=' 
WHERE 
  key_id = 'a2ee5a9d09ca255162c6e13981cbf609933fc6fb7b9caa318073cd06e887f0f9' 
  AND (
    token = 'YOoY7A0ngW9Z2B43GFUbcEEZ61F6q047aypsCT5vw4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026