UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nq5xvcKSr2KTSfEr7krNpTB+QSrSGUVTtMfAUAkj2+U='
WHERE
key_id = '4ff2086b15b1dd0a784a5e3f930a5103f482d74438d152280796976ab9820afe'
AND (
token = 'Nq5xvcKSr2KTSfEr7krNpTB+QSrSGUVTtMfAUAkj2+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)