UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q60RAoZD9WGG+ML8NSUEQF4KmNpbONEOfJc6qH5isdo='
WHERE
key_id = 'd158bee3dec9fd14a7d61a3f8efa01db64204459534cf87e3fc5f45285a31bbc'
AND (
token = 'Q60RAoZD9WGG+ML8NSUEQF4KmNpbONEOfJc6qH5isdo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)