UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'edQV+wguifnK4SmnyyWfh8S8VE5n9u8sKTNGET74Nq4='
WHERE
key_id = 'ac792265a6c651e7b9401b2337126e4eed925913568f0c9ab8721a8c6808f3c3'
AND (
token = 'edQV+wguifnK4SmnyyWfh8S8VE5n9u8sKTNGET74Nq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)