UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PQYZJon2D5CrBsw67i5vhz40qn+D6PDZ+WnKOcg1MXs='
WHERE
key_id = 'c80b58d3d2d32479dd86be3dfe6502b3a1ee9ec2e971320c3ab96d5efc61c57a'
AND (
token = 'PQYZJon2D5CrBsw67i5vhz40qn+D6PDZ+WnKOcg1MXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)