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