UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HmVh3GJKuEIzXYO+vFpaBpsV071WyY04PfMVD33gmAU='
WHERE
key_id = '6047daa9d6f5690eebc70ef13d7bae1a72aec8e8f2773c8766423246b3a2a363'
AND (
token = 'HmVh3GJKuEIzXYO+vFpaBpsV071WyY04PfMVD33gmAU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)