UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9sajycrAbLgWxZSf6xvh3FguVcVPJrXHu4rb5NLBx7Y='
WHERE
key_id = '0cec75046ec05f3b5ae0e4652e9803683629fd4d1e3590818a205dc1f1b1da9e'
AND (
token = '9sajycrAbLgWxZSf6xvh3FguVcVPJrXHu4rb5NLBx7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)