UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zb1G2rSLwQFVHH6u9bs4ZtlUyxACW1VKw1d486jeAVM='
WHERE
key_id = '62d83cacff09b46f91b16e8f75f6baab17bef7664ef13c16856120f1f797dcc5'
AND (
token = 'zb1G2rSLwQFVHH6u9bs4ZtlUyxACW1VKw1d486jeAVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)