UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'udG6nqC/TzEJ7w6DcnM1r/c8SuJYwf286c8DD2ZhMRc='
WHERE
key_id = 'a5323c46167abec07c98b9856b889b74fe8a5ead61160c2f888d43052aee4b5f'
AND (
token = 'udG6nqC/TzEJ7w6DcnM1r/c8SuJYwf286c8DD2ZhMRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)