UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PBFRBLUj9QqJetYd/C+W9gFHTBwyrPwCaI0RajYSuDg='
WHERE
key_id = 'dde9f0702fca587f471b29aec7475f48db8894503b01280312b79f38c1b172f3'
AND (
token = 'PBFRBLUj9QqJetYd/C+W9gFHTBwyrPwCaI0RajYSuDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)