UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDtWaNRjJy1b5NTIxHJ5CHE/aSDWWp7t/CaoAYuvb6Q='
WHERE
key_id = '1a799309d8465ef9842b8178ead4ddbfa2e70f4ac43bf9a87ba51968d09d065e'
AND (
token = 'sDtWaNRjJy1b5NTIxHJ5CHE/aSDWWp7t/CaoAYuvb6Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)