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