UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UDQPuth2dFdfYyC0rFRMaKcu4fLtmJisJ2sWf1WNcus='
WHERE
key_id = 'a1674b75b3fc245b61b179fa3acad96f08d42803e3aa64d2dd51b3a7b0366eb4'
AND (
token = 'UDQPuth2dFdfYyC0rFRMaKcu4fLtmJisJ2sWf1WNcus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)