UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8/eqz5rSvGCaeUlH0j6MKITTc6ABATbEe6+Pn2YXdDk='
WHERE
key_id = 'f4c9ef8195a46fca1dce6419ec6fadb69c9428694eb8f2977c50ecd7f939bd79'
AND (
token = '8/eqz5rSvGCaeUlH0j6MKITTc6ABATbEe6+Pn2YXdDk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)