UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QVgHy/zlk4EIcaqd8vFSEifCV88v4aEHgCVJBCfdqcs='
WHERE
key_id = 'e122a6e9cecabd646bb1d04f441da622c7b3a3c2825bd59b679b42bb5837499c'
AND (
token = 'QVgHy/zlk4EIcaqd8vFSEifCV88v4aEHgCVJBCfdqcs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)