UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lySwvdkhv4g7a0WNcOXgOAvhCihNTvVPVAeSd10Fw4I='
WHERE
key_id = '40eedf45f9393818ace0dfca906a00cf99b3bc4cb97b9ed0bad8c801afe8dd7f'
AND (
token = 'lySwvdkhv4g7a0WNcOXgOAvhCihNTvVPVAeSd10Fw4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)