UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N1rf1uBbDDvkaiExYSVn+JEOCVoPWD8Okw6y9lseryA='
WHERE
key_id = '6d9a0e38e0daf0744b6d796a1d008a31de4e98092f3f73fdeca3c9aefa66851a'
AND (
token = 'N1rf1uBbDDvkaiExYSVn+JEOCVoPWD8Okw6y9lseryA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)