UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A8cu4d6q6cKzkim/1QFruCxd8qI6ptKaSQ1U0/+eDZA='
WHERE
key_id = '81a818f4cb64b0b0437d16d1eaf2634b0c201729e983c0836087052ac79aa276'
AND (
token = 'A8cu4d6q6cKzkim/1QFruCxd8qI6ptKaSQ1U0/+eDZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)