UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X0VjrmM04jOZq9fAfFbcY+hW3cGMxBeXCTP6tve0bqo='
WHERE
key_id = '3f0a438122eddbe08c46e16f40a1b6226f84a2eb21c72958067d9e6c51d95083'
AND (
token = 'X0VjrmM04jOZq9fAfFbcY+hW3cGMxBeXCTP6tve0bqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)