UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u+Ea4X63Dj2IXdZJw5ztqXss6s57cjlEAKWpzk3PdY8=' 
WHERE 
  key_id = 'e8a5698f41f28337bdedf8969ed24f05f47138840240baaeb9fded4428ae9c74' 
  AND (
    token = 'u+Ea4X63Dj2IXdZJw5ztqXss6s57cjlEAKWpzk3PdY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028