UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MgvErR0gDFImsuw6XQpJ2blEWsiKhVxJBaajr7bMs+E='
WHERE
key_id = 'c5c9ee80f2c35f5a92a982d9818a3b101262186ddaa69126dd769f8ced1e78dd'
AND (
token = 'MgvErR0gDFImsuw6XQpJ2blEWsiKhVxJBaajr7bMs+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)