UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dt+ATixXt6ilK8NE/9gO4mUJ5C5zA1K9sGVPnnLYjAc='
WHERE
key_id = 'a71683ac119b4dddf18b73586fbead4e6f018da4f7bc892b9c4f132812a5bcbf'
AND (
token = 'dt+ATixXt6ilK8NE/9gO4mUJ5C5zA1K9sGVPnnLYjAc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)