UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5xUBspIIbgGx5LnPtd7/DqF/xZVHoZqAyqwLVKho1/c='
WHERE
key_id = 'f6efbc5ef193bf9be53d910b51eb8eaa4d097439c898a732d89facd218add5dc'
AND (
token = '5xUBspIIbgGx5LnPtd7/DqF/xZVHoZqAyqwLVKho1/c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)