UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AEiUbRWLYPls3bM9h5EjfC4PSaN61zT4qM+j1ugUXiI='
WHERE
key_id = '1b9c3760b4034818e3b79089c1d09508620a3d8406e29e167d84aa5be6339152'
AND (
token = 'AEiUbRWLYPls3bM9h5EjfC4PSaN61zT4qM+j1ugUXiI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)