UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4yDCuZIAGxL5srypm5du+Y36agS0QWBVJnXC2LgSj5g='
WHERE
key_id = 'e8049d1dc69061f60a160d689b95d45ea2c97a5b4b97d83d72a1a5dd2dc61bff'
AND (
token = '4yDCuZIAGxL5srypm5du+Y36agS0QWBVJnXC2LgSj5g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)